package com.zys.el.user.util.TFIDF;

public class Word implements Comparable<Word> {
    String name;
    Double tf;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getTf() {
        return tf;
    }

    public void setTf(Double tf) {
        this.tf = tf;
    }

    public Word(String name, Double tf) {
        super();
        this.name = name;
        this.tf = tf;
    }

    public Word() {
        super();
    }

    @Override
    public String toString() {
        return "Word [name=" + name + ", tf=" + tf + "]";
    }

    public int compareTo(Word o) {    //重写排序方法，后面方便降序排序
        if (this.tf > o.tf)
            return -1;
        else if (this.tf < o.tf)
            return 1;
        return 0;
    }

}
